﻿<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>用户列表</title>
<link rel="stylesheet" type="text/css" href="<s:property value="staticsRoot"/>/css/style.css"/>
<script type="text/javascript" src="<s:property value="staticsRoot"/>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<s:property value="staticsRoot"/>/js//My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(".data tr:odd").css("background","#fff");
});

</script>
<s:if test="oper == 'success'">
<script type="text/javascript">
	alert("操作成功!");
</script>
</s:if>
</head>

<body id="user_mag">
<div class="right">
	<h3 class="title box"> 
    	当前位置：GameCenter后台管理&nbsp;&gt;&gt; 游戏管理 &gt;&gt;&nbsp;列表 
    </h3>
    <form name="updateform" id="updateform" action="updGame.html" method="post">
    	<input type="hidden" id="update_gameId" name="data.gameId"/>
    	<input type="hidden" id="update_scoreWeight" name="data.scoreWeight"/>
    	<input type="hidden" id="update_rankFactorFormula" name="data.rankFactorFormula"/>
    	<input type="hidden" id="update_status" name="data.status"/>
    </form>
    <form name="form1" id="form1" action="gameList.html" method="post">
    <table cellpadding="0" cellspacing="0" width="100%" class="table_top box">
    	<tr>
        	<td width="60%" height="50" align="right"> 
        		游戏状态： 
            	<select class="select" name="status">
            		<option value="-2" <s:if test='status == null||status == -2'>selected="selected"</s:if>>所有</option>
                	<option value="0" <s:if test='status == 0'>selected="selected"</s:if>>正常</option>
                	<option value="-1" <s:if test='status == -1'>selected="selected"</s:if>>已删除</option>
                </select> 
                                          游戏ID： 
                <input type="text" class="i_text" id="gameId" name="gameId" value="<s:property value='#request.gameId' />"/>&nbsp;
                
            </td>
            <td align="left" style="padding-left:10px;">
            	<div class="lit_btn">
                    <a href="#" onclick="query()">查&nbsp;询</a>
                </div>
            </td>
        </tr>
        <tr>
        	<td width="60%" height="50" align="right">
        		
            </td>
            <td align="left" style="padding-left:10px;">
            </td>
        </tr>
        
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" class="data">
    	<tr>
        	<td width="10%" height="29" align="center">游戏ID</td>
        	<td width="20%" height="29" align="center">游戏图片</td>
            <td width="30%" align="center">游戏名称</td>
            <td width="10%" align="center">天梯分权重</td>
            <td width="15%" align="center">排名计算公式</td>
            <td width="15%" align="center">状态</td>
            <td>操作</td>
        </tr>
        <s:iterator value="#request.list" var="game">
        	<tr>
	        	<td height="29"><s:property value="#game.gameId"/></td>
	        	<td><a border="0" target="_blank" href="http://www.7k7k.com/swf/<s:property value="#game.gameId"/>.htm"><img src="<s:property value="#game.gamePic"/>"/></a></td>
	            <td><a target="_blank" href="http://www.7k7k.com/swf/<s:property value="#game.gameId"/>.htm"><s:property value="#game.gameName"/></a></td>
	            <td><input id="scoreWeight_<s:property value="#game.gameId"/>" type="text" value="<s:property value="#game.scoreWeight"/>"/></td>
	            <td><input id="rankFactorFormula_<s:property value="#game.gameId"/>" type="text" value="<s:property value="#game.rankFactorFormula"/>"/></td>
	            <td>
	            	<select id="status_<s:property value="#game.gameId"/>">
	            		<option <s:if test="#game.status == null || #game.status == 0">selected</s:if> value="0">正常</option>
	            		<option <s:if test="#game.status == -1">selected</s:if> value="-1">删除</option>
	            	</select>
	            </td>
	            <td>
	            <a href="#" onclick="modify('<s:property value="#game.gameId"/>')">确认修改</a>
	            </td>
        	</tr>
        </s:iterator>
    </table>
    <%@include file="page.jsp" %>
    
    </form>
    <form name="addform" id="addform" action="addGame.html" method="post">
    <table cellpadding="0" cellspacing="0" width="100%" class="data">
    	<tr>
        	<td width="10%" height="29" align="center">游戏ID</td>
            <td width="10%" align="center">游戏名称</td>
            <td width="5%" align="center">天梯分权重</td>
            <td width="5%" align="center">排名计算公式</td>
            <td width="5%" align="center">状态</td>
            <td>操作</td>
        </tr>
        
        
        <tr>
        	<td><input name="data.gameId" type="text" value=""/></td>
            <td></td>
            <td><input name="data.scoreWeight" type="text" value=""/></td>
            <td><input name="data.rankFactorFormula" type="text" value=""/></td>
            <td>
            	<select name="data.status">
	            		<option selected value="0">正常</option>
	            		<option value="-1">删除</option>
	            </select>
			</td>
            <td>
            	 <a href="#" onclick="addGame()">新增</a>
            </td>
        </tr>
        
    </table>
    </form>
    
    <form name="uploadform" id="uploadform" action="uploadGame.html" enctype="multipart/form-data"  method="post">
    	<table cellpadding="0" cellspacing="0" width="100%" class="table_top box">
    	<tr>
        	<td width="60%" height="50" align="right"> 
    		Excel文件:
    		</td>
    		<td width="40%"><input type="file" name="excel"><input type="submit" value="上传" />
            </td>
        </tr>
        </table>
    </form>
</div>

<script type="text/javascript">
	function query(){
		$("#form1").submit();
	}
	function doSearch(pageNumber){
		if(pageNumber <= 0){
			pageNumber = 1;
		}	
		$("#page").val(pageNumber); 
		$("#form1").submit(); 
	}

	function modify(gameId){
		$("#update_gameId").val(gameId);
		$("#update_scoreWeight").val($("#scoreWeight_"+gameId).val());
		$("#update_rankFactorFormula").val($("#rankFactorFormula_"+gameId).val());
		$("#update_status").val($("#status_"+gameId).val());
		$("#updateform").submit(); 
	}	
	function addGame(){
		$("#addform").submit();
	}	
</script>
</body>
</html>
